<template>
	<view class="content">
		<view class="content_box">
			<view class="title">
					<view class="left"><b @click="selectPerson">{{userData.xming0}}</b>的住院充值记录</view>
					<view class="edit_icon left" @click="selectPerson"></view>
					<view class="right" @click="selectTime"><span>{{timeData.title}}</span><view class="select_icon right"></view></view>
			</view>
			<view class="content_box_list">
				<ul>
					<li v-for="(item,index) in subjectList" :key="index" @click="detail()">
						<view class="left">
							<b>{{item.zffs00}}</b>
							<p>{{item.czdjh0}}</p>
							<p>{{item.jyrq00}}</p> 
						</view>
						<view class="right"><span >{{item.fyje00}}元</span></view>
					</li>
				</ul>
			</view>
		</view>
		<personList styles="display:none;" ref="personList" v-on:checkedPerson= "getDatas"></personList>
		<dateTimeSelect styles="display:none;" ref="dateTimeSelect" v-on:checked= "getTime"></dateTimeSelect>
	</view>
</template>

<script>
	import personList from "../../modules/personList.vue";
	import dateTimeSelect from "../../modules/dateTimeSelect.vue";
	export default {
		data() {
			return {
				subjectList:[],
				userData:{"xming0":"默认用户"},
				timeData:{"title":"查询时间"}
			}
		},
		components:{
			personList,dateTimeSelect
		},
		onLoad() {
		},
		methods: {
			init(userData){
				let user=uni.getStorageSync("user");
				if(userData){
					user=userData;
				}
				this.userData=user;
				let qureyParams={
					kh0000:user.sfzh00,
					klx000:"3",
					funid:"F07.02.02.02",
					ywlsh0:""+new Date().getTime()
				}
				this.$postJson("/qnyesb/qnyesbproxy",qureyParams,queryRes=>{
					if(queryRes.state==0){
						let params={
							kh0000:user.sfzh00,//user.sfzh00,
							zyh000:queryRes.data.zyh000,
							klx000:"3",
							patid0:queryRes.data.patid0,//user.patid0,
							ksrqi0:this.timeData.startDate,
							jzrqi0:this.timeData.endDate,
							ywlsh0:""+new Date().getTime(),
							funid:"F07.07.02.03"
						}
						uni.showLoading({
							mask:true,
							title:"加载中..."
						})
						this.$postJson("/qnyesb/qnyesbproxy",params,res=>{
							if(res.state==0){
								this.subjectList=res.data.retrieve;
							}else{
								uni.showToast({
									title:res.message,
									icon:"none"
								})
							}
							uni.hideLoading();
						})
					}else{
						let _this=this;
						this.subjectList=[];
						uni.showModal({
							title:"温馨提示",
							content:"您暂无住院信息~点击确定返回首页",//queryRes.message
							mask:true,
							cancelText:"其他就诊人",
							success(showRes) {
								if(showRes.confirm){
									uni.switchTab({
										url:"../index/index"
									})
								}else{
									_this.selectPerson();
								}
							}
						})
					}
				})
			},
			selectPerson(){
				this.$refs.personList.selectPerson();
			},
			getDatas(item){
				this.userData=item;
				this.init(userData);
			},
			selectTime(){
				this.$refs.dateTimeSelect.select();
			},
			getTime(item){
				this.timeData=item;
				this.init();
			},
			detail(){
				// uni.navigateTo({
				// 	url:"payRecordDetail"
				// })
			}
		}
	}
</script>

<style>
.content_box .title{
	width: 92%;
	background-color: #FFFFFF;
	padding: 10px;
	margin: 0 auto;
	border-radius: 6px;
	margin-top: 2px;
	display: flow-root;
}
.content_box .title .edit_icon{
	width: 22px;
	height: 22px;
	background-image: url(../../static/198@2x.png);
	background-size: 100% 100%;
}
.content_box .title .select_icon{
	width: 10.37px;
	height: 5.49px;
	background-image: url(../../static/177@2x.png);
	background-size: 100% 100%;
	margin-top: 10px;
}
.content_box .title .right span{
	margin-right: 15px;
}
.content_box .content_box_list{
	width: 100%;
	margin: 0 auto;
	border-radius: 6px;
	margin-top: 10px;
}
.content_box .content_box_list ul{
	width: 100%;
}
.content_box .content_box_list ul li{
	width: 92%;
	padding: 10px;
	background-color: #FFFFFF;
	font-size:14px;
	border-radius: 6px;
	margin: 0 auto;
	line-height: 30px;
	display: flex;
	align-items: center;
	margin-top: 10px;
	
}
.content_box .content_box_list ul li .left{
	width: 65%;
}
.content_box .content_box_list ul li span{
	font-size:20px;
	font-weight:540;
	color: #1DBE00;
	text-align: right;
}
.content_box .content_box_list ul li b{
	width: 100%;
	display:inline-block;
	line-height: 20px!important;
	word-break: break-all;
	font-size: 1rem;
}
.content_box .content_box_list ul li p{
	width: 100%;
	color: #666666;
}
.content_box .content_box_list ul li .right{
	width: 35%;
	text-align: center;
}
</style>
